package asia.yuanding.wechat.system.util;

import asia.yuanding.wechat.web.entity.User;

/**
 * @ClassName: UserInfo
 * @Author: YuanDing
 * @Date: 2025/7/26 12:32
 * @Description:
 */


public class ThreadUser {

    private static final ThreadLocal<User> userInfo = new ThreadLocal<>();

    public static void setUserInfo(User user){
        userInfo.set(user);
    }

    public static User getUserInfo(){
        return userInfo.get();
    }

    public static void removeUserInfo(){
        userInfo.remove();
    }

    public static String getUId(){
        if (userInfo.get() != null) {
            return userInfo.get().getUid();
        }

        return null;

    }




}
